package com.leyou.gateway.web;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

//降级方法
@RestController
public class FallBackController {

    /**
     * 默认超时处理逻辑
     * @return 熔断降级方法
     */
    @GetMapping(value = "/hystrix/fallback")
    public ResponseEntity<String> fallBack() {
        //status获取HttpStatus中的异常状态码
        //网关超时504
        return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body("请求超时");
    }
}
